/**
 * Create by richliu1023
 * @date 2016-07-02
 * @email richliu1023@gmail.com
 * @github https://github.com/RichLiu1023
 * @description a simple explanation
 */
class NoticeTxtUI extends egret.DisplayObjectContainer {
	private _textField:egret.TextField;
	private _bgImg:egret.Bitmap;

	public constructor() {
		super();
		this._bgImg = new egret.Bitmap( RES.getRes( 'tips_notice_png' ) );
		this._bgImg.scale9Grid = new egret.Rectangle( 263, 9, 179, 54 );
		this.addChild( this._bgImg );
		this._bgImg.anchorOffsetY = 15;
		this._textField = new egret.TextField();
		this._textField.fontFamily = "黑体";
		this.addChild( this._textField );
	}

	public show( txt:string ):void {
		this._textField.textFlow = rm.htmlParser.parser( txt );
		var w = this._textField.textWidth;
		this._bgImg.width = w + 200;
		this._bgImg.anchorOffsetX = (w + 200)/2;
		this._textField.anchorOffsetX = w / 2;
	}

	public clear():void {
		this._textField.textFlow = null;
	}
}